 #!/bin/sh

array=(`ls /var/www/html/sqlite/*.sql`)
len=${#array[*]}
HTMLDB="/var/www/html/sqlite/html_content.db"
SCRIPTDIR="/var/myscheduler"
#First let's clean out the previous contents in the database.
#/usr/bin/sqlite3 $HTMLDB < $SCRIPTDIR/delete_html_content.sql
/usr/bin/sqlite3 $HTMLDB < $SCRIPTDIR/delete_html_content.sql
echo "/usr/bin/sqlite3 $HTMLDB < $SCRIPTDIR/delete_html_content.sql"
i=0
while [ $i -lt $len ]; do
  FullPath="${array[$i]}"
  #perl /var $SCRIPTDIR/batch_insert.pl $HTMLDB < $FullPath 
  #echo "$SCRIPTDIR/batch_insert.pl Processing: $FullPath into $HTMLDB"
  /usr/bin/sqlite3 $HTMLDB < $FullPath
  echo "/usr/bin/sqlite3 $HTMLDB < $FullPath"
	let i++
done